package com.ccx.coachsite.ui.softmgr;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;

import com.ccx.coachsite.api.CoachSiteSoftMgrApiAccessor;
import com.ccx.coachsite.ui.customview.LazyViewPager;

public class SoftMgrTabLazyViewPager extends LazyViewPager {
	
	public SoftMgrTabLazyViewPager(Context context) {
		super(context);
	}

	public SoftMgrTabLazyViewPager(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public SoftMgrTabLazyViewPager(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}

	@Override
	protected boolean loadContentData(int childAt) {
		View loadView = getChildAt(childAt);
		switch (childAt) {
		case 0:
			if ( loadView instanceof SoftMgrTopicView ) {
				((SoftMgrTopicView)loadView).initView();
				((SoftMgrTopicView)loadView).initData();
			}
			break;
		case 1:
			if ( loadView instanceof SoftMgrSoftListView ) {
				SoftMgrSoftListView tmpView = (SoftMgrSoftListView)loadView;
				tmpView.initData();
			}
			break;	
		case 2:
			if ( loadView instanceof SoftMgrSoftListView ) {
				SoftMgrSoftListView tmpView = (SoftMgrSoftListView)loadView;
				tmpView.setReqBaseURLForGame(CoachSiteSoftMgrApiAccessor.API_SOFTMGR_GAME_TYPE_LIST, 
						CoachSiteSoftMgrApiAccessor.API_SOFTMGR_GAME_LIST);
				tmpView.initData();
			}
			break;
			
		case 3:
			if ( loadView instanceof SoftMgrSearchView ) {
				((SoftMgrSearchView)loadView).initView();
			}
			break;
		}
		
		return true;
	}
}
